FsUnit `should equal` fails on `Some []`

Posted by SHiNKiROU on Stack Overflow See other posts from Stack Overflow or by SHiNKiROU
Published on 2014-06-02T08:02:42Z Indexed on 2014/06/02 9:26 UTC
Read the original article Hit count: 130

Filed under:
|
|

When I run this FsUnit test with NUnit 2.6.3,

let f xs = Some (List.map ((+) 2) xs)

[<Test>]
let test() =
  f []
  |> should equal (Some [])

I get:

Result Message: 
Expected: <Some([])>
  But was:  <Some([])>
Result StackTrace:  
at FsUnit.TopLevelOperators.should[a,a](FSharpFunc`2 f, a x, Object y)

The test fails even though the Expected and Actual in the message are the same. What happened?

© Stack Overflow or respective owner

Related posts about F#

Related posts about nunit